package WaiBao;

import java.util.Arrays;

public class MengRuiHong {
    public static void main(String[] args) {
        String[] name = {"王生安(班长)","李欣(团支书)", "小李(学习委员)","薛世界(纪律委员)", "张顺股(宣传委员)", "易姜维", "岳兴起", "康尨茸", "周一一", "卢铁青", "文装箱", "吴胜萌",
                "汤唯", "李可", "徐明月", "宁裕兴", "朱接", "陆从", "潘峰", "武大郎", "林青霞", "肖柏腾", "张怀生", "天刀山", "茉莉恩", "王浩应", "周卓号", "唐科",
                "唐欣怡", "蒙瑞红 (学生)"};//考生本人: 蒙瑞红 (学生)
        int[] age = {19, 20, 21, 18, 19, 20, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 18, 19};//最后一位：考生年龄:19

        double[] caomei1 = {78, 72, 71, 86, 78, 79, 78, 89, 81, 90, 91, 87, 85, 79, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 74, 88, 95};
        double[] caomei2 = {78, 74, 84, 83, 75, 94, 68, 69, 70, 70, 90, 77, 76, 84, 69, 65, 76, 70, 66, 98, 72, 71, 95, 86, 75, 88, 84, 64, 80, 95};
        double[] caomei3 = {72, 71, 82, 91, 74, 89, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 95};

        double shouji ;//代表每个学生的总分
        double tv;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            shouji = caomei1[i] +caomei2[i] + caomei3[i];
//            tv = (shouji * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + shouji);
//            System.out.println(name[i] + "的平均分为:" + tv);
//        }


        double bamboo = 0,chicken= 0;
        double[]  duck  = new double[30];
//        for (int i = 0; i < 30; i++) {
//            bamboo  = caomei1[i] +  caomei2[i] +caomei3[i];
//            chicken = (bamboo * 1.0) / 3;
//            duck [i] = chicken;
//        }
//
//        for (int i = 0; i < duck.length - 1; i++) {
//            for (int j = 0; j <  duck .length - i - 1; j++) {
//                if (duck [j] < duck [j + 1]) {
//                    double tep = duck[j];
//                    duck[j] = duck[j + 1];
//                    duck[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(duck[i]);
//        }



        double pony1 = 0,  pony2 = 0, pony3 = 0;//计算每门课的平均分
        double mule1 = 0,mule2 = 0,mule3 = 0;//计算每门课标准差
        double donkey1 = 0, donkey2 = 0,donkey3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < caomei1.length; i++) {
            he += caomei1[i];
        }
        pony1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" + pony1);
        double Sum = 0;
        for (int i = 0; i < caomei2.length; i++) {
            Sum +=caomei2[i];
        }
        pony2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" +pony2);
        double sum = 0;
        for (int i = 0; i < caomei3.length; i++) {
            sum +=caomei3[i];
        }
        pony3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" +  pony3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <caomei1.length; i++) {
            c1 += (caomei1[i] - pony1) * (caomei1[i] -pony1);
        }
        mule1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" + mule1);
        for (int i = 0; i < caomei2.length; i++) {
            c2 += (caomei2[i] - pony2) * (caomei2[i] - pony2);
        }
        mule2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" +mule2);

        for (int i = 0; i <caomei3.length; i++) {
            c3 += (caomei3[i] -  pony3) * (caomei3[i] - pony3);
        }
        mule3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" + mule3);
//////////
////////
//        Arrays.sort(caomei1);
//        Arrays.sort(caomei2);
//        Arrays.sort(caomei3);
//        donkey1 = (caomei1[14] + caomei1[15]) * 1.0 / 2;
//        donkey2 = (caomei2[14] +caomei2[15]) * 1.0 / 2;
//        donkey3 = (caomei3[14] + caomei3[15]) * 1.0 / 2;
//        System.out.println("农业设施及环境调控的中位数为:" +  donkey1);
//        System.out.println("农业设施设计与制造的中位数为:" +  donkey2);
//        System.out.println("园艺植物设施栽培学的中位数为:" +  donkey3);




    }
}
